After succesfully accomplishing the exercises on tidy data and listening to lengthy lectures on data formats as well as specifics of importing them, it’s now your turn to get used to importing data in the tidyverse.
We prepared some datasets, for example, the Titanic dataset from Kaggle, which you can use to play with some of the functions from readr and related packages. You can find them in the ../data folder. However, importing data often implies firing up only one command and that’s it. For this reason, in these exercises, we prepared some special tasks you can work on.
This being said, let’s start with some easy data importing.
readr library and the function read_...
You may have noticed that the function you just used is importing factor variables as characters by default. For some analyses, this is not what we want. So let’s pretend we’re particularly interested in gender differences in a regression model or the like.
Sex to a factor.
After working on the titanic data we got bored. Now we want to work on some longitudinal and cross-country level data. The gapminder GDP data comes to our mind!
Although you had to apply two different importing functions, the outcome is no different: what you got are tibbles. However, especially the file format of the latter dataset is more complex. In the last exercise we expand on that and apply some more options with the help of the unicorn data.
total_turnover variable only read in the cell range A1:C43
range = range_definition.